package com.briup.srms.project.web.controller;

import javax.validation.constraints.NotNull;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.srms.project.bean.extend.StudentProjectExtend;
import com.briup.srms.project.service.IStudentProjectService;
import com.jacky.base.utils.Message;
import com.jacky.base.utils.MessageUtil;
import com.jacky.base.utils.PageVM;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @program: 杰普学生管理系统
 * @description: 毕业设计选题控制器类
 * @author: charles
 * @create: 2021-1-14 11:09
 **/
@Api(description="毕业设计选题相关接口")
@Validated
@RestController
@RequestMapping("/project/studentProject")
public class StudentProjectController {
	@Autowired
	private IStudentProjectService studentProjectService;
	
	@ApiOperation(value = "分页多条件获取毕业设计信息")
	@GetMapping("pageQuery")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "page", value = "当前页", required = true, paramType = "query"),
		@ApiImplicitParam(name = "pageSize", value = "每页大小", required = true, paramType = "query"), 
		@ApiImplicitParam(name = "realname", value = "姓名", paramType = "query"),
		@ApiImplicitParam(name = "clazzId", value = "杰普班级编号", paramType = "query"),
		@ApiImplicitParam(name = "status", value = "状态", paramType = "query"),
		@ApiImplicitParam(name = "channelIds", value = "渠道", paramType = "query"),
		@ApiImplicitParam(name = "stuTypes", value = "学生类型", paramType = "query"),
	})
	public Message pageQuery(@NotNull int page, int pageSize,String realname,Long clazzId,String status,Long[] channelIds,String[] stuTypes) {
		PageVM<StudentProjectExtend> pageVM = studentProjectService.pageQuery(page, pageSize,realname,clazzId,status,channelIds,stuTypes);
		return MessageUtil.success(pageVM);
	}
	
	@ApiOperation(value = "选题")
	@GetMapping("selectProject")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, paramType = "query"),
		@ApiImplicitParam(name = "projectId", value = "项目编码", required = true, paramType = "query"), 
	})
	public Message selectProject(long studentId,long projectId) {
		studentProjectService.selectProject(studentId, projectId);
		return MessageUtil.success("选题成功！");
	}
	
	
	

}
